#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
  vector<int> vec = {5, 4, 6, 8, 2, 100, 3, 7, 9};
  int target = 10;
  int index = find_if(vec.begin(), vec.end(), [target](int x) {
    return x > target;
  }) - vec.begin();
  cout << index << ": " << vec[index] << endl;

  target = 5;
  int indexCount = find_if(vec.begin(), vec.end(), [target, count = 0](int x) mutable {
    return x > target && ++count == 5;
  }) - vec.begin();
  cout << indexCount << ": " << vec[indexCount] << endl;
}